project(lighttcp)
set(CMAKE_BUILD_TYPE Debug)
cmake_minimum_required(VERSION 3.22)
find_package(OpenSSL)
add_library(lighttcpserver server.cpp)
add_executable(server main.cpp)
add_library(lighttcpclient client.cpp)
add_executable(client clientmain.cpp)
add_library(lighttcpsslserver sslserver.cpp)
add_executable(sslserver sslmain.cpp)
add_library(lighttcpsslclient sslclient.cpp)
add_executable(sslclient sslclientmain.cpp)
if(WIN32)
add_definitions(-DWIN32)
target_link_libraries(server lighttcpserver Ws2_32)
target_link_libraries(client lighttcpclient Ws2_32)
if(OPENSSL_FOUND)
target_link_libraries(sslserver lighttcpsslserver Ws2_32 ${OPENSSL_LIBRARIES})
target_link_libraries(sslclient lighttcpsslclient Ws2_32 ${OPENSSL_LIBRARIES})
endif()
else()
target_link_libraries(server lighttcpserver)
target_link_libraries(client lighttcpclient)
if(OPENSSL_FOUND)
target_link_libraries(sslserver lighttcpsslserver ${OPENSSL_LIBRARIES})
target_link_libraries(sslclient lighttcpsslclient ${OPENSSL_LIBRARIES})
endif()
endif()